namespace GomuLibrary.IO.DiscImage
{
    using System;
    using System.Runtime.InteropServices;

    [StructLayout(LayoutKind.Sequential, Pack=1)]
    internal struct DirectoryRecord
    {
        public const int OFFSET_DIR_REC_LENGTH = 0;
        public const int OFFSET_EXT_ATTR_LENGTH = 1;
        public const int OFFSET_EXTENT_LOC = 2;
        public const int OFFSET_DATA_LENGTH = 10;
        public const int OFFSET_REC_DATETIME = 0x12;
        public const int OFFSET_FILE_FLAGS = 0x19;
        public const int OFFSET_FILE_UNIT_SIZE = 0x1a;
        public const int OFFSET_INTERLEAVE = 0x1b;
        public const int OFFSET_VOLUME_SEQUENCE_NUMBER = 0x1c;
        public const int OFFSET_FILEID_LEN = 0x20;
        public const int OFFSET_FILEID_NAME = 0x21;
        [MarshalAs(UnmanagedType.I1)]
        public byte Length;
        [MarshalAs(UnmanagedType.I1)]
        public byte ExtentAttrLength;
        [MarshalAs(UnmanagedType.U4)]
        public uint ExtentLocation;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
        public byte[] Unused1;
        [MarshalAs(UnmanagedType.U4)]
        public uint DataLength;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
        public byte[] Unused2;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=7)]
        public byte[] DateTimeRecord;
        [MarshalAs(UnmanagedType.I1)]
        public FileFlags Flags;
        [MarshalAs(UnmanagedType.I1)]
        public byte FileUnitSize;
        [MarshalAs(UnmanagedType.I1)]
        public byte InterleaveGapSize;
        [MarshalAs(UnmanagedType.U2)]
        public ushort VolumeSequenceNumber;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=2)]
        public byte[] Unused3;
        [MarshalAs(UnmanagedType.I1)]
        public byte FileIdLength;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
        public char[] FileId;
    }
}

